<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link
      rel="stylesheet"
      href="../../lib/bootstrap-3.3.5-dist/css/bootstrap.min.css"
    />
    <script src="../../lib/bootstrap-3.3.5-dist/js/jquery-1.11.3.js"></script>
    <script src="../../lib/bootstrap-3.3.5-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="../../css/bumen.css" />
  </head>
  <body>
    <div class="container-fluid">
      <div class="row">
        <div id="nav" class="col-lg-12">
          <div id="btn"></div>
        </div>
      </div>
      <div id="content" class="row"></div>
    </div>
  </body>
  <script>
    let pageContent = [
      { id: 1, name: "基本信息", url: "./jiben.html" },
      { id: 1, name: "用户信息", url: "./yonghu.html" },
    ];
    showDiv();
    $("#btn div a").eq(0).addClass("active");
    $("#content").load("./jiben.html");
    function showDiv() {
      pageContent.forEach((item) => {
        $("#btn").append(
          `<div><a data-url='${item.url}'>${item.name}</a></div>`
        );
      });
    }
    $("#btn div a").click(function () {
      $(this)
        .addClass("active")
        .parent()
        .siblings()
        .children()
        .removeClass("active");
      let url = $(this).attr("data-url");
      $("#content").load(url);
    });
  </script>
</html>
